Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The min-dash npm package is a minimal utility library for JavaScript that provides a set of functions for common programming tasks. It is designed to be lightweight and efficient, making it suitable for use in performance-sensitive applications.
Array Manipulation
min-dash provides functions like `filter` and `map` to manipulate arrays. `filter` is used to create a new array with all elements that pass the test implemented by the provided function. `map` creates a new array with the results of calling a provided function on every element in the calling array.
const { filter, map } = require('min-dash');
const numbers = [1, 2, 3, 4, 5];
const evenNumbers = filter(numbers, n => n % 2 === 0);
const squaredNumbers = map(numbers, n => n * n);
console.log(evenNumbers); // [2, 4]
console.log(squaredNumbers); // [1, 4, 9, 16, 25]
Object Manipulation
min-dash provides functions like `assign` and `keys` for object manipulation. `assign` is used to copy the values of all enumerable own properties from one or more source objects to a target object. `keys` returns an array of a given object's own enumerable property names.
const { assign, keys } = require('min-dash');
const obj1 = { a: 1, b: 2 };
const obj2 = { b: 3, c: 4 };
const mergedObj = assign({}, obj1, obj2);
const objKeys = keys(mergedObj);
console.log(mergedObj); // { a: 1, b: 3, c: 4 }
console.log(objKeys); // ['a', 'b', 'c']
Function Utilities
min-dash provides function utilities like `bind` and `debounce`. `bind` creates a new function that, when called, has its `this` keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called. `debounce` creates a debounced function that delays invoking the provided function until after a specified wait time has elapsed since the last time the debounced function was invoked.
const { bind, debounce } = require('min-dash');
function greet(name) {
console.log('Hello ' + name);
}
const boundGreet = bind(greet, null, 'World');
boundGreet(); // 'Hello World'
const debouncedGreet = debounce(greet, 1000);
debouncedGreet('Alice');
debouncedGreet('Bob'); // Only 'Hello Bob' will be logged after 1 second
Lodash is a modern JavaScript utility library delivering modularity, performance, and extras. It provides a wide range of utility functions for common programming tasks, similar to min-dash, but with a larger footprint and more features.
Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects. It offers similar functionalities to min-dash but is more comprehensive and has been around longer.
Ramda is a practical functional library for JavaScript programmers. It makes it easy to create functional pipelines and is designed to be a more functional programming-oriented alternative to libraries like lodash and underscore.
Minimal utility tool belt to be used with bpmn.io related libraries.
2kB
minified and gzippedimport {
find,
sortBy,
assign
} from 'min-dash';
Your favourite module bundler should apply tree-shaking to only include the components your application requires. If you're using CommonJS modules give common-shake a try.
MIT
2.4.0
CHORE
: add browser
fieldFAQs
Minimum utility toolbelt
The npm package min-dash receives a total of 131,442 weekly downloads. As such, min-dash popularity was classified as popular.
We found that min-dash demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.